<? /* license

BilugCMS (http://www.bilug.it) - Content Management System for dynamic web sites
Copyright (C) 2005-2008  Federico Villa and Alessio Loro Piana

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

For reference, contact bilugcms@vilnet.it


license */ ?>

<?
require_once("auth.php");
$id = $_GET['id'];

$errore=null;
$errore=$_GET["errore"];
$tipoerr=$_GET["tipoerr"];
if($errore=="si")
{
		echo "<h1><img src=\"./img/alert.png\" id=\"ico\" />$tipoerr<img src=\"./img/alert.png\" id=\"ico\" /></h1>";
}

$annulla = "<input type=\"button\" 
	class=\"medio\" name=\"Annulla\" value=\"Annulla\" onclick=\"javascript:window.location='area.php?pag=elenco_menu_new.php'\" />";

$str="SELECT titolo, tipo FROM menutipo WHERE id='$id'";
$risultato=mysql_query($str);
if (mysql_num_rows($risultato)>0)
{
  	$control=mysql_fetch_row($risultato);
}

?>

<div class="contenitore">
<form name="modify_link" method="post" action="insert_sotmenu_link_query.php" enctype="multipart/form-data">
<input type="hidden" name="id" value="<?=$id?>"/>

<!-- il valore di id lo passiamo alla pagina di action con un campo nascosto -->
	<h3>link:</h3>
<div class="azzerafloat"></div>
	<div class="float100">	<h1>Titolo:</h1>  </div>
	<div class="float200">	<? echo"$control[0]";?>	</div>
	<div class="float100"> <h1>Tipo:</h1> </div>
	<div class="float100"> <? echo"$control[1]";?> </div>
	<br><br>
	<div class="float100">	<h1>link:</h1>  </div>
	<div class="azzerafloat"></div>
	<br><br>
	<div class="float100"> &nbsp; </div>
	<div class="float100">	<h1>news:</h1> </div>
	<div class="float20"> <input type="radio" class="little" name="tipolink" value="nw"> </div>
    <div class="float500">	
    <select name="news">
		<option value=""> &nbsp;</option>
	<?
	$strs=" SELECT titolo , argomento ,ID FROM notizie where autorizza='si' order by argomento";
	$risultatos=mysql_query($strs);
	$argomento=0;
	$primo=0;
	while($controls=mysql_fetch_row($risultatos))
	{
		if ($argomento != $controls[1])
		{
			if ($primo!=0)
			{
				echo "</optgroup>";
				$primo =1;
			}
			$str1s=" SELECT argomenti FROM argomenti WHERE ID='$controls[1]'";
	   	$risultato2s=mysql_query($str1s);
	   	$control1s=mysql_fetch_row($risultato2s);
	   	echo "<optgroup label=\"Argomento - $control1s[0]\">";
	   	$argomento=$controls[1];
	   }
	   echo "<option value=\"$controls[2]\">$controls[0]</option>";
	}
	?>
    </select>
    </div>
    <br><br>
    <div class="float100"> &nbsp; </div>
	<div class="float100">	<h1>statiche:</h1>  </div>
    <div class="float20">	<input type="radio" class="little" name="tipolink" value="st"></div>
    <div class="float500">	
    <select name="statiche">
		<option value=""> &nbsp;</option>
	<?
    $stat=" SELECT id,titolo FROM statiche ORDER BY ordine";
	$ristat=mysql_query($stat);
	while($statiche=mysql_fetch_row($ristat))
    {
		echo "<option value=\"$statiche[0]\">$statiche[1]</option>";
	}
    ?>
    </select>
    </div>
    <br><br>
    <div class="float100"> &nbsp; </div>
    <div class="float100">	<h1>gallerie:</h1>  </div>
    <div class="float20">	<input type="radio" class="little" name="tipolink" value="gl"></div>
    <div class="float500">	
    <select name="gallerie">
		<option value=""> &nbsp;</option>
	<?
	$dir='../gals';	
	if ($handle = opendir($dir)) 
	{
		while (false !== ($file = readdir($handle))) 
		{ 
			if ($file != '.' and $file != '..' and filetype($dir."/".$file) == 'dir')
			{
				echo "<optgroup label=\"$file\">";
				
					$dir1='../gals/'.$file;
					if ($handle1 = opendir($dir1)) 
					{
						$fileord = array();   
						while (false !== ($filenoord = readdir($handle1))) 
						{
							$fileord[] = $filenoord;
						}
							natcasesort($fileord);      
						foreach ($fileord as $key => $value)   
							$files[] = $value;
						foreach ($files as $key => $file1)
						{
							if ($file1 != '.' and $file1 != '..' and filetype($dir1."/".$file1) == 'dir')
							{
								echo "<option value=\"d=$file1&argo=$file\">".str_replace("_"," ",substr($file1,strpos($file1,"_")+1))."</option>";
							}
						}
					}
					closedir($handle1);
				echo "</optgroup>";
			}
		}
    }
    closedir($handle);
    ?>
    </select>
    </div>
    <br><br>
    <div class="float100"> &nbsp; </div>
    <div class="float100">	<h1>esterno:</h1>  </div>
    <div class="float20">	<input type="radio" class="little" name="tipolink" value="ex"></div>
    <div class="float20">&nbsp;</div>
	<div class="float100">	<input type="text" name="ext" value="">
    </div>
    <br><br>
    <div class="float100"> &nbsp; </div>
    <div class="float100">	<h1>Home:</h1>  </div>
    <div class="float20">	<input type="radio" class="little" name="tipolink" value="hm"></div>
    <div class="float20">&nbsp;</div>
	<div class="float100">	&nbsp;
    </div>
    <br><br>
     <div class="float100"> &nbsp; </div>
    <div class="float100">	<h1>Scrivici:</h1>  </div>
    <div class="float20">	<input type="radio" class="little" name="tipolink" value="sc"></div>
    <div class="float20">&nbsp;</div>
	<div class="float100">	&nbsp;
    </div>
    <br><br>
     <div class="float100"> &nbsp; </div>
    <div class="float100">	<h1>Ecommerce:</h1>  </div>
    <div class="float20">	<input type="radio" class="little" name="tipolink" value="ec"></div>
    <div class="float20">&nbsp;</div>
	<div class="float100">	&nbsp;
    </div>
    <br><br>
    <input class="medio" type="submit" value="invia"/>
	<?=$annulla?>
	
</form>
</div>	
	
